<?php
class Presenter_list extends CI_Controller{
	public function __construct(){
		parent::__construct();
		if(!isset($_SESSION)){session_start();}
		$this->load->model('presenter_model');
	}
	
	public function index(){
		//$data['news'] = $this->news_model->get_news();
		$data['title'] = 'Presenter List';
		
		$this->load->view('templates/header',$data);
//		$this->load->view('news/index',$data);
		$this->load->view('templates/footer');
	}
	
	public function add_presenter(){
		$this->load->helper('form');
		$this->load->library('form_validation');
	
		$data['title'] = 'Register';
	
		$this->form_validation->set_rules('username', 'Username', 'required');
		$this->form_validation->set_rules('password', 'Password', 'required');
		$this->form_validation->set_rules('field', 'Field', 'required');
	
		if ($this->form_validation->run() === FALSE && !isset($_SESSION['user_id']))
		{
			$this->load->view('templates/header', $data);
			$this->load->view('registerationForms/presenter_registeration');
			$this->load->view('templates/footer');
	
		}
		else
		{
			if(!isset($_SESSION['user_id'])){
				$this->presenter_model->create_presenter();
			}	

			$data['title'] = 'Login';
			$this->load->view('templates/header', $data);
			$this->load->view('pages/home');
			$this->load->view('templates/footer');
		}
	}
/*
	public function update_presenter(){
	}
	
	public function delete_presenter(){
	}
*/
	public function view_dashboard($user_id){
		$data['title'] = 'Dashboard';
		$this->load->view('templates/header', $data);
		$this->load->view('presenter/presenter_dashboard', $data);
		$this->load->view('templates/footer');
	}
}
?>